import request from '@/utils/request'

export function getRoleList(params) {
  return request({
    url: '/online/authorization/role',
    method: 'get',
    params
  })
}

export function getAllRole(params) {
  return request({
    url: 'online/authorization/role/list/all',
    params, 
    method: 'GET'
  })
}

export function roleInfo({ roleId }) {
  return request({
    url: `online/authorization/role/${roleId}`,
    method: 'GET'
  })
}

export function newRole({ roleName, roleFunctionList }) {
  return request({
    url: `online/authorization/role`,
    method: 'POST',
    data: {
      roleName,
      roleFunctionList
    }
  })
}

export function updateRole({ roleId, roleName, roleFunctionList }) {
  return request({
    url: `online/authorization/role/${roleId}`,
    method: 'POST',
    data: {
      status: 1,
      roleName,
      roleFunctionList
    }
  })
}

export function deleteRole(roleId) {
  return request({
    url: `online/authorization/role/${roleId}`,
    method: 'DELETE'
  })
}

export function getRoleMenuFunctions({ roleId }) {
  return request({
    url: `online/authorization/role/${roleId}/menu-functions`
  })
}

export function listRole(params) {
  return request({
    url: `online/authorization/role/list/all`,
    method: 'GET',
    params
  })
}

export function listModule(params) {
  return request({
    url: `online/authorization/role/list/all`,
    method: 'GET',
    params
  })
}


